Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdout standardization with output formatter #56

Merged
merged 48 commits into from
Mar 22, 2024

Conversation

amydevs
Copy link
Contributor

@amydevs amydevs commented Nov 10, 2023

Description

This PR fixes all the CLI stdout inconsistencies, this is kind of tedious and not critical at the moment though.

Changelog

  • agent
    • CommandStatus - versionMetadata is no longer spread into parent object with JSON format.
    • CommandBootstrap - Now uses dict format to output the recoveryCode.
  • identities
    • CommandAuthenticate - Now uses dict format
    • CommandClaim - Dict Output, JSON format is now of type { claimId: string; url?: string }.
    • CommandInvite - Feedback is now moved to logger.info so that it goes to stderr
    • CommandList output should be reconsidered due to nested structure. *
    • CommandSearch and CommandGet need streamlining in terms of their output *
  • keys
    • CommandCert - Uses dict format
    • CommandCertchain - The message at the start is no longer included.
    • CommandEncrypt - Raw format
    • CommandDecrypt - Raw format
    • CommandSign - now uses camelcase for non-json formats
    • CommandVerify - now uses camelcase for non-json formats
    • CommandPublic, Private, and Pair will need to have further consideration due to nested structure. *
  • nodes
    • CommandClaim - Stderr feedback and stdout of success *

Dict Format

This PR also implements changes to the dict format that allows for nesting.

Changes made to commands with this:

agent/CommandStatus

status                  LIVE
pid                     90556
nodeId                  vq3pk7bip927v2ivk7457p5g7b4q3ad0jksqrkv9rfkhl31l1ukng
clientHost              ::1
clientPort              33179
agentHost               ::
agentPort               35454
upTime                  9
startTime               1711068204
connectionsActive       2
nodesTotal              8
version                 1.2.1-alpha.50-1-1
sourceVersion           1.2.1-alpha.50
stateVersion            1
networkVersion          1
versionMetadata  
  version               0.2.3
  commitHash            9275aa5d0d5470e9e586a6fbbdc8ca150c37e5aa
  libVersion            1.2.1-alpha.50-1-1
  libSourceVersion      1.2.1-alpha.50
  libStateVersion       1
  libNetworkVersion     1

identities/CommandList

gestalt
  actionsList       notify
  identities 
    github.com:amydevs
  nodeIds    
    vq3pk7bip927v2ivk7457p5g7b4q3ad0jksqrkv9rfkhl31l1ukng
gestalt
  actionsList       scan
  identities 
    github.com:amydevs
  nodeIds    
    vq3pk7bip927v2ivk7457p5g7b4q3ad0jksqrkv9rfkhl31l1ukng

notificiations/CommandRead

notificiation
  data  
    message test message 1
    type    General
  iat       1711063520.438
  isRead    true
  iss       vmqmqq9h4jgduaeifep1nko1j2uebgg0uh48sc4fl9upqdsijjmf0
  sub       voeo52qencdh720o084mlfpgb1st09vjca0ti9qvm6e0p19ma316g
  typ       notification
notificiation
  data  
    message test message 2
    type    General
  iat       1711063520.438
  isRead    true
  iss       vmqmqq9h4jgduaeifep1nko1j2uebgg0uh48sc4fl9upqdsijjmf0
  sub       voeo52qencdh720o084mlfpgb1st09vjca0ti9qvm6e0p19ma316g
  typ       notification

Issues Fixed

Tasks

  • 1. Fix all necessary list formatted outputs to just be strings.
  • 2. Fix all necessary list formatted outputs to just be dicts.
  • 3. Fix json formatted outputs to return structured POJO rather than just an array with the message itself.
  • 4. Implement nesting in dict format
  • 5. Fix related tests.

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@ghost
Copy link

ghost commented Nov 10, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@CMCDragonkai
Copy link
Member

This can be incrementally cherry-picked? Or will you do it one go?

@CMCDragonkai
Copy link
Member

Cherry pick relevant commits back to staging @amydevs

@CMCDragonkai CMCDragonkai mentioned this pull request Nov 15, 2023
@amydevs
Copy link
Contributor Author

amydevs commented Nov 15, 2023

the first two commits have been cherrypicked into staging, remember to rebase after

@CMCDragonkai
Copy link
Member

You should rebase this PR if you've cherrypicked, since then this will be left with just 1 commit! Otherwise it will be confusing.

@CMCDragonkai CMCDragonkai changed the title Feature stdout standardization Stdout standardization with output formatter Nov 15, 2023
@amydevs amydevs force-pushed the feature-stdout-standardization branch from 986f63b to ff9345e Compare November 15, 2023 05:43
@amydevs amydevs force-pushed the feature-stdout-standardization branch from ff9345e to 7329770 Compare December 14, 2023 23:48
@CMCDragonkai
Copy link
Member

There's still a problem here: #124 (comment)

@CMCDragonkai
Copy link
Member

This needs rebase to be ready to go. I think this week @amydevs you're back on PK #40.

@amydevs amydevs force-pushed the feature-stdout-standardization branch 3 times, most recently from 2a08f93 to a986613 Compare February 28, 2024 23:30
@amydevs amydevs force-pushed the feature-stdout-standardization branch 3 times, most recently from ce60f6d to 6ff85b3 Compare March 4, 2024 04:51
@CMCDragonkai
Copy link
Member

Can you expand the task list so we know how close we are finishing this?

@CMCDragonkai
Copy link
Member

@amydevs where's the counter?

@amydevs amydevs force-pushed the feature-stdout-standardization branch 9 times, most recently from 3ad9573 to 9017511 Compare March 15, 2024 02:14
@amydevs amydevs force-pushed the feature-stdout-standardization branch 2 times, most recently from 962fa32 to c38fb62 Compare March 22, 2024 02:41
@amydevs amydevs force-pushed the feature-stdout-standardization branch from c38fb62 to 18d223c Compare March 22, 2024 02:42
@amydevs amydevs merged commit da7af41 into staging Mar 22, 2024
This was referenced Mar 22, 2024
@CMCDragonkai CMCDragonkai added the r&d:polykey:supporting activity Supporting core activity label Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r&d:polykey:supporting activity Supporting core activity
Development

Successfully merging this pull request may close these issues.

3 participants